package com.ruoyi.schedule.service.impl;

import com.ruoyi.schedule.domain.SchedulePlan;
import com.ruoyi.schedule.mapper.SchedulePlanMapper;
import com.ruoyi.schedule.service.ISchedulePlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 排班计划 服务层实现
 */
@Service
public class SchedulePlanServiceImpl implements ISchedulePlanService {
    @Autowired
    private SchedulePlanMapper schedulePlanMapper;
    
    @Autowired
    private IScheduleAlgorithmService scheduleAlgorithmService;

    @Override
    public List<SchedulePlan> selectSchedulePlanList(SchedulePlan schedulePlan) {
        return schedulePlanMapper.selectSchedulePlanList(schedulePlan);
    }

    @Override
    public int insertSchedulePlan(SchedulePlan schedulePlan) {
        return schedulePlanMapper.insertSchedulePlan(schedulePlan);
    }

    @Override
    public int updateSchedulePlan(SchedulePlan schedulePlan) {
        return schedulePlanMapper.updateSchedulePlan(schedulePlan);
    }

    @Override
    public int deleteSchedulePlanByIds(Long[] planIds) {
        return schedulePlanMapper.deleteSchedulePlanByIds(planIds);
    }
    
    @Override
    public Map<Long, List<Shift>> generateSchedule(SchedulePlan plan, List<Rule> rules, List<Shift> shifts) {
        return scheduleAlgorithmService.generateSchedule(plan, rules, shifts);
    }
    
    @Override
    public boolean validateRules(List<Rule> rules) {
        return scheduleAlgorithmService.validateRules(rules);
    }
}